﻿using HuaweiCloud.Dotnet.Samples.ESports.Main.Dtos;
using HuaweiCloud.Dotnet.Samples.ESports.Main.Service;
using Microsoft.AspNetCore.Mvc;

namespace HuaweiCloud.Dotnet.Samples.ESports.Main.Controllers
{
    [Route("api-main/v1/[controller]")]
    [Route("api/v1/[controller]")]
    [ApiController]
    public class BindInfoController : ControllerBase
    {
        private readonly IBindInfoService _service;
        public BindInfoController(IBindInfoService service)
        {
            _service = service;
        }
        [Route("bind")]
        [HttpPost]
        public async Task<ActionResult> Bind([FromBody] CreateBindInfoDto dto)
        {
            await _service.BindAsync(dto);
            return Created("", null);
        }

        [Route("unbind")]
        [HttpPost]
        public async Task<ActionResult> Unbind([FromBody] DeleteBindInfoDto dto)
        {
            await _service.UnbindAsync(dto);
            return NoContent();
        }
    }
}
